import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login.vue'
import Layout from '@/layouts/Layout.vue'
import Dashboard from '@/views/Dashboard.vue'
import NotFound from '@/views/NotFound.vue'

// 系统管理页面
import Users from '@/views/system/Users.vue'
import Roles from '@/views/system/Roles.vue'
import Permissions from '@/views/system/Permissions.vue'

// 内容管理页面
import Articles from '@/views/content/Articles.vue'
import Categories from '@/views/content/Categories.vue'

// 设备管理页面
import Devices from '@/views/device/Devices.vue'
import DeviceDetail from '@/views/device/DeviceDetail.vue'
import DeviceAdd from '@/views/device/DeviceAdd.vue'
import DeviceEdit from '@/views/device/DeviceEdit.vue'

// 会议管理页面
import Meetings from '@/views/meeting/Meetings.vue'
import MeetingDetail from '@/views/meeting/MeetingDetail.vue'
import MeetingAdd from '@/views/meeting/MeetingAdd.vue'
import MeetingEdit from '@/views/meeting/MeetingEdit.vue'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Dashboard',
        component: Dashboard
      },
      // 系统管理路由
      {
        path: '/users',
        name: 'Users',
        component: Users
      },
      {
        path: '/roles',
        name: 'Roles',
        component: Roles
      },
      {
        path: '/permissions',
        name: 'Permissions',
        component: Permissions
      },
      // 内容管理路由
      {
        path: '/articles',
        name: 'Articles',
        component: Articles
      },
      {
        path: '/categories',
        name: 'Categories',
        component: Categories
      },
      // 设备管理路由
      {
        path: '/devices',
        name: 'Devices',
        component: Devices
      },
      {
        path: '/device/detail',
        name: 'DeviceDetail',
        component: DeviceDetail
      },
      {
        path: '/device/add',
        name: 'DeviceAdd',
        component: DeviceAdd
      },
      {
        path: '/device/edit',
        name: 'DeviceEdit',
        component: DeviceEdit
      },
      // 会议管理路由
      {
        path: '/meetings',
        name: 'Meetings',
        component: Meetings
      },
      {
        path: '/meeting/detail',
        name: 'MeetingDetail',
        component: MeetingDetail
      },
      {
        path: '/meeting/add',
        name: 'MeetingAdd',
        component: MeetingAdd
      },
      {
        path: '/meeting/edit',
        name: 'MeetingEdit',
        component: MeetingEdit
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: NotFound
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router